<?php
getHeader();

if (isset($_SESSION['authPassed']))
{
	$album = imageFile::getAlbumByAid($_GET['aid']);
	if ($album['albumOwner'] == $_SESSION['uid'])
	{
		if (isset($_POST['do']))
		{
			if ($_POST['do'] == 'del')
			{
				if (imageFile::delAlbumByAid($_POST['aid']))
				{
					?>
<div id="content">
<div class="tabs headTabs"><span>相册操作</span></div>
<div class="dataList"><span>删除成功.</span></div>
</div>
					<?php
				}
				else
				{
					?>
<div id="content">
<div class="tabs headTabs"><span>相册操作</span></div>
<div class="dataList"><span>删除失败.</span></div>
</div>
					<?php
				}
			}
			else if ($_POST['do'] == 'mod')
			{
				if (!isset($_POST['albumName']))
				{
					?>
<div id="content">
<div class="tabs headTabs"><span>相册操作</span></div>
<div class="dataList">
<form action='?p=editAlbum&aid=<?php echo $_GET['aid']; ?>'
	method="post">相册名: <input type="text" name="albumName"
	value='<?php echo $album['albumName']; ?>' /> <input type="hidden"
	name="aid" value="<?php echo $_GET['aid']; ?>" /> <input type="hidden"
	name="do" value="mod" /> <input type="submit" class="button" value="提交" />
</form>
</div>
</div>
					<?php
				}
				else
				{
					if (imageFile::updateAlbumName($_POST['aid'],$_POST['albumName']))
					{
						?>
<div id="content">
<div class="tabs headTabs"><span>相册操作</span></div>
<div class="dataList"><span>修改成功.</span></div>
</div>
						<?php
					}
					else
					{
						?>
<div id="content">
<div class="tabs headTabs"><span>相册操作</span></div>
<div class="dataList"><span>修改失败.</span></div>
</div>
						<?php
					}
				}
			}
		}
		else
		{
			?>
<div id="content">
<div class="tabs headTabs"><span>相册操作</span></div>
<div class="dataList">
<form action='?p=editAlbum&aid=<?php echo $_GET['aid']; ?>'
	method="post"><select name="do">
	<option value="mod">修改</option>
	<option value="del">删除</option>
</select> <input type="hidden" name="aid"
	value="<?php echo $_GET['aid']; ?>" /> <input type="submit"
	class="button" value="提交" /></form>
</div>
</div>
			<?php
		}
	}
	else
	{
		?>
<div id="content">
<div class="tabs headTabs"><span>相册操作</span></div>
<div class="dataList"><span>你无权对该相册进行操作</span></div>
</div>
		<?php
	}
}
getPanel();
getFooter();
?>